Used vendored base64 encoding implementation rather than Foundation.Data #539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uses @fabianfett's base64 implementation rather than Foundation. Apparently it's faster, and it avoids copying the string to a Foundation.Data object before encoding.
Single-file version copied from https://github.com/apple/swift-nio/blob/main/Sources/NIOWebSocket/Base64.swift
I disabled swiftformat on the file so that, other than the copyright header and swiftformat comment, it remains identical to the version in NIO. Alternatively, we could add a package dependency rather than copying the file. Up to you guys.
With this and #534, the only remaining Foundation dependencies will be
URL
, and the couple of convenience APIs in theFoundationExtensions
file. If they're both accepted, I can go through and replace all occurrences ofimport Foundation
withimport struct Foundation.URL
in a follow-up.There are already tests for this API, so I didn't feel it necessary to add any.